/**
 * @project_name staff_vehicle
 * @package_name com.ssh.ser.askfl
 * @desc TODO
 * @param
 * @author jack
 * @date 2013-4-23
 * @time 下午5:07:47
 */
package com.ssh.ser.common;

import java.util.List;

import com.ssh.dao.AskForleaveDAOI;
import com.ssh.entity.AskForleave;
import com.ssh.model.pdata.AskForLeaveMData;

/**
 * @author jack
 * @desc 员工请假结果查看查看类
 * @property askFLDAOI 员工请假操作数据库接口
 */
public class AskForLeaveSerImpl implements AskForLeaveSerI {
	private AskForleaveDAOI askFLDAOI;

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * com.ssh.ser.askfl.AskForLeaveSerI#addAskFL(com.ssh.entity.AskForleave)
	 */
	@Override
	public AskForleave addAskFL(AskForleave askFL) {
		// TODO Auto-generated method stub
		try {
			askFLDAOI.addAskFL(askFL);
		} catch (Exception e) {
			return null;
		}

		return askFL;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * com.ssh.ser.askfl.AskForLeaveSerI#backAskFL(com.ssh.entity.AskForleave)
	 */
	@Override
	public AskForleave IAmBack(AskForleave askFL) {
		// TODO Auto-generated method stub
		try {
			askFLDAOI.updateAskFL(askFL);
		} catch (Exception e) {
			return null;
		}

		return askFL;
	}

	/**
	 * @return the askFLDAOI
	 */
	public AskForleaveDAOI getAskFLDAOI() {
		return askFLDAOI;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * com.ssh.ser.askfl.AskForLeaveSerI#leaveAskFL(com.ssh.entity.AskForleave)
	 */
	@Override
	public AskForleave IGonaLeave(AskForleave askFL) {
		// TODO Auto-generated method stub
		try {
			askFLDAOI.updateAskFL(askFL);
		} catch (Exception e) {
			return null;
		}
		return askFL;
	}

	/**
	 * @param askFLDAOI
	 *            the askFLDAOI to set
	 */
	public void setAskFLDAOI(AskForleaveDAOI askFLDAOI) {
		this.askFLDAOI = askFLDAOI;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see com.ssh.ser.askfl.AskForLeaveSerI#viewAskFL(java.lang.String)
	 */
	@Override
	public AskForleave viewAskFL(String askFLId) {
		// TODO Auto-generated method stub
		return askFLDAOI.queryAskFLById(askFLId);
	}

	@Override
	public AskForleave viewAskForLeaveById(int id) {
		// TODO Auto-generated method stub
		return askFLDAOI.queryById(id);
	}

	/* (non-Javadoc)
	 * @see com.ssh.ser.common.AskForLeaveSerI#viewAskFLList(java.lang.String)
	 */
	@Override
	public List<AskForleave> viewAskFLList(String staffId) {
		// TODO Auto-generated method stub
		return askFLDAOI.queryMyAFL(staffId);
	}

	@Override
	public List<AskForLeaveMData> viewAllAskForLeave() {
		// TODO Auto-generated method stub
		return askFLDAOI.queryAllAskForLeave();
	}

	@Override
	public List<AskForLeaveMData> viewAllAskForLeave(int state) {
		// TODO Auto-generated method stub
		return askFLDAOI.queryAllAskForLeave(state);
	}

	
	@Override
	public List<AskForLeaveMData> viewOneAskForLeave(
			String idWhoAskForLeave,int state) {
		// TODO Auto-generated method stub
		return askFLDAOI.queryOneAskForLeave(idWhoAskForLeave, state);
	}

	@Override
	public AskForleave agreeAskForLeave(AskForleave askForleave) {
		// TODO Auto-generated method stub
		return askFLDAOI.updateAskFL(askForleave);
	}

	@Override
	public AskForleave disAgreeAskForLeave(AskForleave askForleave) {
		// TODO Auto-generated method stub
		return askFLDAOI.updateAskFL(askForleave);
	}

}
